#include "LynxException_C.hpp"

namespace Lynx
{

Exception_C::Exception_C(LYNX_EXCEPTION_CODE code, const std::string &description, const std::string &short_function, const std::string &long_function, const std::string &file, uint32_t line) throw() :
    mCode(code),
    mDescription(description),
    mShortFunction(short_function),
    mLongFunction(long_function),
    mFile(file),
    mLine(line)
{
    mFullDescription = mShortFunction + ": " + mDescription;
}

Exception_C::Exception_C(const Exception_C &other) throw() :
    mCode(other.mCode),
    mDescription(other.mDescription),
    mShortFunction(other.mShortFunction),
    mLongFunction(other.mLongFunction),
    mFile(other.mFile),
    mLine(other.mLine),
    mFullDescription(other.mFullDescription)
{
    //
}

Exception_C::~Exception_C() throw()
{
    //
}

void Exception_C::operator=(const Exception_C &other) throw()
{
    mCode = other.mCode;
    mDescription = other.mDescription;
    mShortFunction = other.mShortFunction;
    mLongFunction = other.mLongFunction;
    mFile = other.mFile;
    mLine = other.mLine;
    mFullDescription = other.mFullDescription;
}

LYNX_EXCEPTION_CODE Exception_C::get_exception_code(void) const throw()
{
    return mCode;
}

uint32_t Exception_C::get_line(void) const throw()
{
    return mLine;
}

const std::string &Exception_C::get_description(void) const throw()
{
    return mDescription;
}

const std::string &Exception_C::get_full_description(void) const throw()
{
    return mFullDescription;
}

const std::string &Exception_C::get_file(void) const throw()
{
    return mFile;
}

const std::string &Exception_C::get_short_function(void) const throw()
{
    return mShortFunction;
}

const std::string &Exception_C::get_long_function(void) const throw()
{
    return mLongFunction;
}

const char *Exception_C::what(void) const throw()
{
    return mFullDescription.c_str();
}

} // namespace Lynx
